package com.google.zxing.client.homework;

import com.google.zxing.Result;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

/**
 * Created by yanmaoshen on 2017/11/19.
 */

public class HomeworkInfo implements Serializable {

    static final long serialVersionUID = 3453521L;
    private int Version = -1;
    private int Type = -1;
    private long HomeworkOrWrongBookID = -1;
    private long StudentID = -1;
    private long classID = -1;
    private int Outter_t = -1;
    private int Outter_l = -1;
    private int Outter_b = -1;
    private int Outter_r = -1;
    private int PN = -1;
    private int Left1 = -1;//选项最左端
    private int Left2 = -1;//第二列最左端
    private int optionWidth = -1;//选项识别宽度
    private int notOptionWidth = -1;//非选择题宽度
    private int Inner_t = -1;//和outter结构类似，表示剪裁区域的位置坐标
    private int Inner_l = -1;
    private int Inner_b = -1;
    private int Inner_r = -1;
    private int W1 = -1;//特征点图片宽度
    private int W2 = -1;//二维码图片宽度
    private int CH = 1820;//PIXEL NUM
    private int LEFT_IN_1ST_COLUMN_QUESTION = 35;//16;//PIXEL NUM
    private int LEFT_IN_2ND_COLUMN_QUESTION = 789;//288;//PIXEL NUM
    private int WIDTH_IN_CHOICE_QUESTION = 42;//37;//PIXEL NUM
    private int HEIGHT_IN_CHOICE_QUESTION = 30;//37;//PIXEL NUM
    private int WIDTH_IN_NOT_CHOICE_QUESTION = 300;//258;//PIXEL NUM  ?????
    private List<QuestionInfo> questionList = new ArrayList<QuestionInfo>();

    public HomeworkInfo(float scale) {
        if (scale != 1.0f){
            CH *= scale;
            LEFT_IN_1ST_COLUMN_QUESTION *= scale;
            LEFT_IN_2ND_COLUMN_QUESTION *= scale;
            WIDTH_IN_CHOICE_QUESTION *= scale;
            HEIGHT_IN_CHOICE_QUESTION *= scale;
            WIDTH_IN_NOT_CHOICE_QUESTION *= scale;
        }
    }

    public int getVersion() {
        return Version;
    }

    public void setVersion(int version) {
        Version = version;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public long getHomeworkOrWrongBookID() {
        return HomeworkOrWrongBookID;
    }

    public void setHomeworkOrWrongBookID(long homeworkOrWrongBookID) {
        HomeworkOrWrongBookID = homeworkOrWrongBookID;
    }

    public long getStudentID() {
        return StudentID;
    }

    public void setStudentID(long studentID) {
        StudentID = studentID;
    }

    public int getOutter_t() {
        return Outter_t;
    }

    public void setOutter_t(int outter_t) {
        Outter_t = outter_t;
    }

    public int getOutter_l() {
        return Outter_l;
    }

    public void setOutter_l(int outter_l) {
        Outter_l = outter_l;
    }

    public int getOutter_b() {
        return Outter_b;
    }

    public void setOutter_b(int outter_b) {
        Outter_b = outter_b;
    }

    public int getOutter_r() {
        return Outter_r;
    }

    public void setOutter_r(int outter_r) {
        Outter_r = outter_r;
    }

    public int getPN() {
        return PN;
    }

    public void setPN(int PN) {
        this.PN = PN;
    }

    public long getClassID() {
        return classID;
    }

    public void setClassID(long classID) {
        this.classID = classID;
    }

    public int getLeft1() {
        return Left1;
    }

    public void setLeft1(int left1) {
        Left1 = left1;
    }

    public int getLeft2() {
        return Left2;
    }

    public void setLeft2(int left2) {
        Left2 = left2;
    }

    public int getOptionWidth() {
        return optionWidth;
    }

    public void setOptionWidth(int optionWidth) {
        this.optionWidth = optionWidth;
    }

    public int getInner_t() {
        return Inner_t;
    }

    public void setInner_t(int inner_t) {
        Inner_t = inner_t;
    }

    public int getInner_l() {
        return Inner_l;
    }

    public void setInner_l(int inner_l) {
        Inner_l = inner_l;
    }

    public int getInner_b() {
        return Inner_b;
    }

    public void setInner_b(int inner_b) {
        Inner_b = inner_b;
    }

    public int getInner_r() {
        return Inner_r;
    }

    public void setInner_r(int inner_r) {
        Inner_r = inner_r;
    }

    public int getW1() {
        return W1;
    }

    public void setW1(int w1) {
        W1 = w1;
    }

    public int getW2() {
        return W2;
    }

    public void setW2(int w2) {
        W2 = w2;
    }

    public int getNotOptionWidth() {
        return notOptionWidth;
    }

    public void setNotOptionWidth(int notOptionWidth) {
        this.notOptionWidth = notOptionWidth;
    }

    public int getCH() {
        return CH;
    }

    public void setCH(int CH) {
        this.CH = CH;
    }

    public int getHeightInChoiceQuestion() {
        return HEIGHT_IN_CHOICE_QUESTION;
    }

    public int getLeftIn1stColumnQuestion() {
        return LEFT_IN_1ST_COLUMN_QUESTION;
    }

    public int getLeftIn2ndColumnQuestion() {
        return LEFT_IN_2ND_COLUMN_QUESTION;
    }

    public int getWidthInChoiceQuestion() {
        return WIDTH_IN_CHOICE_QUESTION;
    }

    public int getWidthInNotChoiceQuestion() {
        return WIDTH_IN_NOT_CHOICE_QUESTION;
    }

    public List<QuestionInfo> getQuestionList() {
        return questionList;
    }

    public void setQuestionList(Vector<QuestionInfo> questionList) {
        this.questionList = questionList;
    }

    public void clearQuestionList(){
        this.questionList.clear();
    }

    public void addQuestion(QuestionInfo question) {
        this.questionList.add(question);
    }

    public void addChoiceResultByQI(long qi, int serial){
        for (QuestionInfo qInfo : this.questionList) {
            if (qInfo.getQI() == qi){
                qInfo.addChoiceResult(serial);
                break;
            }
        }
    }

    public void setNotChoiceResultByQI(long qi, String path){
        for (QuestionInfo qInfo : this.questionList) {
            if (qInfo.getQI() == qi){
                qInfo.setPicPath(path);
                break;
            }
        }
    }
}